class Cache {
  static data = {}
  static set(name, value) {
    this.data[name] = value
  }
  static get(name) {
    return this.data[name]
  }
}

let user = {
  name: 'Bob',
  key: Symbol('缓存')
}

let cart = {
  name: '购物车',
  key: Symbol('购物车')
}

Cache.set(user.key, user)
Cache.set(cart.key, cart)
console.log(Cache.get(user.key)) //=> { name: 'Bob', key: Symbol(缓存) }
